package com.white.service.imp;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.white.bean.Article;
import com.white.mapper.ArticleMapper;
import com.white.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
    @Autowired
    ArticleMapper articleMapper;
    @Override
    public List<Article> getArticleListByClassifyId(Long classifyId) {
        return articleMapper.getArticleListByClassifyId(classifyId);
    }

    @Override
    public List<Article> getRecommendArticle(Long recommendUserId) {
        return articleMapper.getRecommendArticle(recommendUserId);
    }

    @Override
    public List<Article> getRecommendArticleByPage(Long recommendUserId, int page, int limit) {
        return articleMapper.getRecommendArticleByPage(recommendUserId, (page - 1) * limit, limit);
    }

    @Override
    public List<Article> getHotArticle() {
        return articleMapper.getHotArticle();
    }

    @Override
    public List<Article> search(String content) {
        return articleMapper.search(content);
    }

    @Override
    public List<Article> getLikeArticleByUserId(Long userId) {
        return articleMapper.getLikeArticleByUserId(userId);
    }

    @Override
    public void viewsInc(Long articleId) {
        articleMapper.viewsInc(articleId);
    }

    @Override
    public List<Article> getHotArticleByPage(int page, int limit) {
        return articleMapper.getHotArticleByPage((page - 1) * limit, limit);
    }

    @Override
    public Article getByArticleId(Long articleId) {
        return articleMapper.getByArticleId(articleId);
    }
}
